<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script src="../node_modules/vue/dist/vue.js"></script>

<body>
    <!-- 表单项，自定义组件 -->
    <div id="app">
        <!-- 2、获取数组下标：v-for="(item,index) in items" -->
        <li v-for="(item, index) in users" :key="index.name" v-if="item.gender == '女'">
            {{index}}:{{item.name}}--{{item.gender}}--{{item.age}}
            <!-- 3、遍历对象：
                        v-for="value in object"
                        v-for="(value,key) in object"
                        v-for="(value,key,index) in object" 
                -->
            <span v-for="(key, value) in item">
                {{key}}--{{value}}---
            </span>
        </li>
        <!-- 4、遍历的时候都加上:key来区分不同数据，提高vue渲染效率 -->
        <li v-for="(num,index) in nums" :key="index">{{num}}</li>
    </div>
</body>
<script>
    new Vue({
        el: "#app",
        data: {
            users: [{ name: '柳岩', gender: '女', age: 21 },
            { name: '张三', gender: '男', age: 18 },
            { name: '范冰冰', gender: '女', age: 24 },
            { name: '刘亦菲', gender: '女', age: 18 },
            { name: '古力娜扎', gender: '女', age: 25 }],
            nums: [1, 2, 3, 4, 4]
        },
        methods: {

        }
    })
</script>
<style>
    .intro {
        color: rgb(255, 0, 30);
    }

    .important {
        color: green;
    }
</style>

</html>